package com.wnxy.list;

import java.util.ArrayList;

public class App2 {
    /**
     * ArrayList 线程不安全
     * @param args
     * @throws InterruptedException
     */
    public static void main(String[] args) throws InterruptedException {
        ArrayList list = new ArrayList();
        for (int i = 0; i < 30; i++) {
            final int temp = i;
            new Thread(() -> {
                list.add(temp);
                System.out.println(list);
            }).start();
        }

    }
}
